package com.example.cms.service.Impl;

import com.example.cms.dao.ConsultantDao;
import com.example.cms.entity.Consultant;
import com.example.cms.service.ConsultantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service("ConsultantService")
@Transactional
public class ConsultantServiceImple implements ConsultantService {

    @Autowired
    private ConsultantDao consultantDao;

    @Override
    public Consultant getConsultantAndCourses(Integer consultantId) {
        return consultantDao.selectConAndCate(consultantId);
    }

    @Override
    public List<Consultant> getConAndCou() {
        return consultantDao.selectAllConsultant();
    }

    @Override
    public Integer getNum() {
        return consultantDao.getNum();
    }

    @Override
    public Integer removeConsultant(Integer consultantId) {//删除
        return consultantDao.deleteConsultant(consultantId);
    }

    @Override
    public Integer eidtConsultant(Consultant consultant) {//修改
        return consultantDao.updateConsultant(consultant);
    }

    @Override
    public Integer addtConsultant(Consultant consultant) {//增加
        return consultantDao.insertConsultant(consultant);
    }
}
